<template>
  <div class="r-list">
    <div
      class="bg"
      :style="{ 'background-image': 'url(' + songlist.coverImgUrl + ')' }"
    ></div>
    <div class="dis">
      <van-card tag="歌单" :thumb="songlist.coverImgUrl">
        <template #title>
          <h2 class="hd-title">
            {{ songlist.name }}
          </h2>
        </template>
        <template #desc>
          <div class="hd-desc">
            <img :src="uSrc" alt="" />
            <div>{{ nickname }}</div>
          </div>
        </template>
      </van-card>
    </div>
    <h3 class="remd_tl">歌曲列表</h3>
    <div class="Music">
      <ul>
        <li
          class="M-list"
          v-for="(item, index) in music"
          :key="index"
          @click="goDetail('/playmusicB', item.id)"
        >
          <div class="list-left">
            <span class="num">{{ index + 1 }}</span>
          </div>
          <div class="list-right">
            <div class="list-cent">
              <span class="tit">{{ item.name }}</span>
              <span class="author"
                >{{ item.ar[0].name }} - {{ item.name }}</span
              >
            </div>
            <div class="play">
              <van-icon name="play-circle-o" />
            </div>
          </div>
        </li>
      </ul>
    </div>
    <!--  -->
    <div class="down">查看更多歌曲,请下载客户端</div>
    <!-- 评论 -->
    <comment name="comment" :id="id"></comment>
  </div>
</template>
<script>
import { getplaylist } from '@/api/remomoned'
import comment from '../../../components/Comment/song-sheet.vue'
export default {
  props: ['id'],
  components: {
    comment
  },
  data: () => ({
    music: [],
    songlist: [],
    uSrc: null,
    nickname: null
  }),
  created() {
    this.getplaylist()
  },
  methods: {
    async getplaylist() {
      const res = await getplaylist(this.id)
      // console.log(res)
      this.music = res.data.playlist.tracks
      this.songlist = res.data.playlist
      // console.log(this.songlist)
      this.uSrc = this.songlist.creator.avatarUrl
      this.nickname = this.songlist.creator.nickname
    }
  }
}
</script>
<style lang="less">
.r-list {
  .bg:after {
    content: " ";
    background-color: rgba(0, 0, 0, 0.25);
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
  }
  .bg {
    width: 100%;
    height: 150px;
    position: absolute;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: 50%;
    -webkit-filter: blur(20px);
    filter: blur(20px);
    transform: scale(1.5);
  }
  .dis {
    padding: 20px 0;
    .van-card__thumb {
      width: 126px;
      height: 126px;
    }
    .hd-title {
      font-weight: 400;
      font-size: 17px;
      color: #fefefe;
      display: -webkit-box;
      -webkit-box-pack: center;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .van-card {
      background-color: unset;
    }
    .hd-desc {
      margin-top: 20px;
      width: 80%;
      display: flex;
      align-items: center;
      color: hsla(0, 0%, 100%, 0.7);
      img {
        display: block;
        width: 50px;
        border-radius: 50%;
        margin-right: 2vh;
      }
      div {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        width: 90px;
      }
    }
  }
  .remd_tl {
    width: 100%;
    font-size: 16px;
    height: 23px;
    line-height: 23px;
    padding: 2px 10px;
    color: #000;
    margin: 0;
    background: #eeeff0;
    z-index: 10;
  }

  .Music {
    .M-list {
      display: flex;
      justify-content: space-between;
      padding: 10px;
      .list-left {
        display: flex;
        width: 20px;
        text-align: center;
        padding-top: 10px;
        .num {
          width: 20px;
        }
      }
      .list-right {
        width: 90%;
        display: flex;
        justify-content: space-between;
        border-bottom: 1px solid #ddd;
        padding-bottom: 8px;
        .list-cent {
          // text-align: left;
          width: 80%;
          display: flex;
          flex-direction: column;
          flex-wrap: wrap;

          .tit {
            width: 100%;
            font-size: 17px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            word-break: normal;
          }
          .author {
            width: 100%;
            font-size: 12px;
            line-height: 20px;
            color: #888;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            word-break: normal;
          }
        }
        .play {
          .van-icon-play-circle-o {
            font-size: 30px;
            vertical-align: middle;
          }
        }
      }
    }
  }
  .down {
    width: 100%;
    padding-top: 8px;
    font-size: 13px;
    color: #888;
    text-align: center;
  }
}
</style>